package com.zjdiepu.www.rest.api.zx;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.zjdiepu.www.base.core.ApiResponse;
import com.zjdiepu.www.common.consts.SystemConsts;
import com.zjdiepu.www.common.util.CollectionInitUtil;
import com.zjdiepu.www.commpent.handler.TokenUserHelper;
import com.zjdiepu.www.ibiz.zx.IZxQueryCreditAppService;
import com.zjdiepu.www.model.base.dto.SysUser;
import com.zjdiepu.www.model.dz.dto.DzSignLoanAmount;

@RestController
@RequestMapping(value= "ZxQueryCreditAppController", produces="application/json;charset=UTF-8")
@Api(tags = {"征信app接口"}, produces="application/json;charset=UTF-8")
public class ZxQueryCreditAppController {

	@Resource
	private IZxQueryCreditAppService zxQueryCreditAppService;
	@Resource
    private TokenUserHelper tokenUserHelper;
	
	 @ApiOperation(value = "统计征信申请查询（主表）录入时间为本月的数量",response = Integer.class, httpMethod="POST")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = SystemConsts.MOBILE_FLAG, defaultValue="ios", value = "请求机器标识", required = true, paramType = "header", dataType = "String"),
    	@ApiImplicitParam(name = SystemConsts.HEADER_FOR_TOKEN, defaultValue="Ajesget8XF7zNMpt+MM8cr0wI8S+IO6a9giEKNouXWvOO3wWWyaKjSDTqRUtHlcNbjCg1JaPdjRX6dX/O1oGLgE=", value = "token", required = true, paramType = "header", dataType = "String")
    })
    @RequestMapping(value = "countZxQueryCredit", method = RequestMethod.POST)
	public ApiResponse countZxQueryCredit(){
		 SysUser currentUser = tokenUserHelper.getUser();
		DzSignLoanAmount dzSignLoanAmount= new DzSignLoanAmount();
		dzSignLoanAmount.setSalersmanId(currentUser.getSalersmanId());
		int count=zxQueryCreditAppService.countZxQueryCredit(dzSignLoanAmount);
		Map<String,Object> response=CollectionInitUtil.emptyMap();
		response.put("count", count);
		return ApiResponse.success(response);
	}
	
//	 @ApiOperation(value = "征信未通过",response = Integer.class, httpMethod="POST")
//    @ApiImplicitParams({
//    	@ApiImplicitParam(name = SystemConsts.MOBILE_FLAG, defaultValue="ios", value = "请求机器标识", required = true, paramType = "header", dataType = "String"),
//    	@ApiImplicitParam(name = SystemConsts.HEADER_FOR_TOKEN, defaultValue="Ajesget8XF7zNMpt+MM8cr0wI8S+IO6a9giEKNouXWvOO3wWWyaKjSDTqRUtHlcNbjCg1JaPdjRX6dX/O1oGLgE=", value = "token", required = true, paramType = "header", dataType = "String")
//    })
//    @RequestMapping(value = "countZxQueryResultCredit", method = RequestMethod.POST)
//	public ApiResponse countZxQueryResultCredit(){
//		 SysUser currentUser = tokenUserHelper.getUser();
//		DzSignLoanAmount dzSignLoanAmount= new DzSignLoanAmount();
//		dzSignLoanAmount.setSalersmanId(currentUser.getId());
//		dzSignLoanAmount.setCreditPeopleType(CarManType.GOU_CHE_REN.getCode());
//		dzSignLoanAmount.setCreditResult(CreditResult.DEBAR.getCode());
//		int count=zxQueryCreditAppService.countZxQueryResultCredit(dzSignLoanAmount);
//		Map<String,Object> response=CollectionInitUtil.emptyMap();
//		response.put("count", count);
//		return ApiResponse.success(response);
//	}
}
